<template>
  <div class="Gmap">
    <div id="container" class="container" :style="{height: mapHeight}"></div>
    <!-- 功能标签 -->
    <Tabs value="name1" class="tabs">
      <TabPane label="标签一" name="name1">标签一的内容</TabPane>
      <TabPane label="标签二" name="name2">标签二的内容</TabPane>
      <TabPane label="标签三" name="name3">标签三的内容</TabPane>
    </Tabs>
  </div>
</template>

<script>
export default {
  name: 'Gmap',
  data () {
    return {
      map: null,  //  全局的地图对象
      mapHeight: '',  //  地图高度
    }
  },
  mounted () {
    this.mapHeight = document.body.clientHeight - 70 + 'px'
    this.$nextTick(function(){
      this.mapInit()  //初始化地图
    })
  },
  methods: {
    mapInit () {
      //  创建地图
      this.map = new AMap.Map('container', {
        zoom: 10,  //缩放级别
        viewMode: '3D',  //使用3D视图
        resizeEnable: true, //是否监控地图容器尺寸变化
        center: [116.397428, 39.90923]  //中心点坐标
      })
      // var zoom = this.map.getZoom(); //获取当前地图级别
      // var center = this.map.getCenter(); //获取当前地图中心位置
    }
  }
}
</script>

<style scoped>
  .Gmap{
    width: 100%;
    height: 100%;
    position: relative;
  }
  .Gmap .container{
    width: 100%;
    background: #ccc;
  }
  .Gmap .tabs{
    width: 100%;
    height: 100px;
    background: #fff;
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 2;
  }
</style>

